package ija.controller;

import ija.view.CheckersContent;
import ija.view.MainMenuContent;
import ija.view.MainWindow;
import ija.view.ReplayerMenuContent;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainController {
    private JFrame mainWindow;

    public JFrame getMainWindow() {
        return this.mainWindow;
    }

    public void setMainWindow(JFrame mainWindow) {
        this.mainWindow = mainWindow;
    }

    private JPanel windowContent;
    private CheckersController gameController;
    private ReplayerController replayController;

    public MainController() {
        this.mainWindow = new MainWindow();
        this.showMainMenu();
    };

    public void showMainMenu() {
        JFrame.setDefaultLookAndFeelDecorated(true);

        this.windowContent = new MainMenuContent(this);
        this.mainWindow.setContentPane(this.windowContent);
        this.mainWindow.pack();
        this.mainWindow.setResizable(true);
        this.mainWindow.setVisible(true);
    };

    public void showGameMenu() {
        this.gameController = new CheckersController(this);
        this.windowContent = new CheckersContent(this.gameController);
        this.mainWindow.setContentPane(this.windowContent);
        this.mainWindow.pack();
        this.mainWindow.setResizable(true);
        this.mainWindow.setVisible(true);
    };

    public void showReplayerMenu() {
        // this.windowContent = new ReplayerContent(this);
        MainWindow mw = new MainWindow();
        ReplayerController rc = new ReplayerController(mw);
        ReplayerMenuContent rmc = new ReplayerMenuContent(rc);
        mw.setContentPane(rmc);
        mw.pack();
        mw.setResizable(true);
        mw.setVisible(true);
    };

    public void showExitDialog() {
    };

    public void ShowAboutDialog() {
    };

    public static void main(String[] argv) {
        new MainController();
    }
}
